﻿Imports System
Imports System.Collections.Generic
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Animation
Imports System.Windows.Media.Imaging
Imports System.Windows.Navigation
Imports System.Windows.Shapes
Namespace Views
    Partial Public Class ViewGraphModelProjection

        Private currentGrid As Integer = 0
        Private graphGrids() As Grid
        Private comments() As String = New String() { _
            "Synthese des résultats toutes garanties confondues", _
            "Synthese des résultats de la garantie décès", _
            "Synthese des résultats de la garantie INCAP"
        }

        Public Sub New()
            MyBase.New()

            Me.InitializeComponent()

            ' Insert code required on object creation below this point.
            graphGrids = New Grid() {grdAll, grdDC, grdINCAP}
            Array.ForEach(Of Grid)(graphGrids, Sub(g As Grid) g.Visibility = Windows.Visibility.Collapsed)
            graphGrids(0).Visibility = Windows.Visibility.Visible
            commentTxt.Text = comments(currentGrid)
        End Sub

        Private Sub ButtonNext_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs)
            'TODO: Add event handler implementation here.
            graphGrids(currentGrid).Visibility = Windows.Visibility.Collapsed
            currentGrid = (currentGrid + 1) Mod graphGrids.Length
            graphGrids(currentGrid).Visibility = Windows.Visibility.Visible
            commentTxt.Text = comments(currentGrid)
        End Sub

        Private Sub ButtonPrevious_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs)
            'TODO: Add event handler implementation here.
            graphGrids(currentGrid).Visibility = Windows.Visibility.Collapsed
            currentGrid = (currentGrid - 1) Mod graphGrids.Length
            currentGrid = If(currentGrid < 0, graphGrids.Length + currentGrid, currentGrid)
            graphGrids(currentGrid).Visibility = Windows.Visibility.Visible
            commentTxt.Text = comments(currentGrid)
        End Sub
    End Class
End Namespace